#ifndef PERSONDATABASE_H
#define PERSONDATABASE_H

#include "Database.h"

#include <QString>

/*!
 * @class PersonInfo
 * @brief Stores personal information of an individual user.
 *
 */

class PersonInfo
{
public:
    PersonInfo();
    PersonInfo(const PersonInfo&);

    QString firstName, middleName, lastName;
    QString addressStreet, addressCity, addressState;

    int addressZip;

    QString lastVisit, birthDate;
};

/*!
 * @addtogroup Database
 * @{
 * @class PersonDatabase
 * @brief Manages personal information loaded from the database.
 *
 * The PersonDatabase class is used to retrieve and store personal information
 * from the database. Personal information includes name, address, birth date;
 * but does not include account information (username, password, etc.). To
 * obtain account information, use the UserDatabase class.
 * @}
 */

class PersonDatabase : protected Database
{
public:
    PersonDatabase();

    /*! Retrieves personal information of user from database.
     * @param userId Id of user to retrieve information about.
     * @returns PersonInfo object with the user's personal information.
     */
    PersonInfo getInfo(int userId);

    /*! Adds personal information for a specific user to the database.
     * @param info Pointer to PersonInfo object with personal information
     *             to be added to the database.
     * @param userId Id of user to retrieve information about.
     * @returns True if information added successfully, false if an error
     *          occured.
     */
    bool addPerson(PersonInfo *info, int userId);

    const static int USER_EXISTS = -2;

private:
    void initDatabase();
};

#endif // PERSONDATABASE_H
